export default{
	state:{
		role:[],
		indexMenu:[],
		myMenu:[]
	},
	mutations:{
		/**获取角色菜单*/ 
		getRoleMenu(state,role){
			uni.setStorageSync('role', role)
			if((role.findIndex((item,index)=>item.name==='jy_repair'))!==-1){
				state.indexMenu=[{ name: '备件库', url:'/pages/partsList/partsList', icon: 'icon-beijiankucun' },
			{ name: '零件库', url: '/pages/materialList/materialList', icon: 'icon-lingjian' },
			{ name: '机器列表', url: '/pages/machineList/machineList', icon: 'icon-jiqi' },
			{ name: '报修处理', url: '/pages/repairList/repairList?state=0', icon: 'icon-order-pending' }];
				state.myMenu=[{ name: '我的维修单', url: '/pages/sendRepairList/sendRepairList?type=send', icon: 'icon-weixiujilu', style: 'circle-blue' },
               { name: '我的保养单', url: '/pages/maintainList/maintainList', icon: 'icon-responseOrder', style: 'circle-yellow' }]
			}
			if((role.findIndex(item=> item.name==='jz_user'))!==-1){
				state.indexMenu=[{ name: '备件库', url:'/pages/partsList1/partsList1', icon: 'icon-beijiankucun' },
				{ name: '零件库', url: '/pages/materialList1/materialList1', icon: 'icon-lingjian' },
				{ name: '机器列表', url: '/pages/machineList/machineList', icon: 'icon-jiqi' },
				{ name: '报修', url: '/pages/repair/repair', icon:'icon-yibaoxiu'}];
				state.myMenu=[{ name: '我的报修单', url: '/pages/repairList/repairList', icon: 'icon-order-mine', style:'circle-yellow'},
               { name: '我的自修单', url: '/pages/sendRepairList/sendRepairList?type=self', icon: 'icon-weixiugongdan', style: 'circle-blue'}]
			}
		}
	}
}